package cn.njp.learn.basic.io;

import java.io.File;
import java.io.IOException;

import org.junit.Test;

public class FilePathExample1 {
	@Test
	public void testFilePath1(){
		String filename = "newfile.txt";
		
		String workDir = System.getProperty("user.dir");
		String absolutePath = workDir + File.separator + filename;
		
		System.out.println("filepath : " + absolutePath);
		
		try {
			File file = new File(absolutePath);
			
			if(file.createNewFile()){
				System.out.println("create new file : " + absolutePath);
			}else{
				System.out.println("file does already exists");
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
